﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
namespace HZ.DrugTrade.Web.Enterprise.RelationQuery
{
    public partial class RelationQueryCompanyMain : BasePage
    {
        public RelationQueryCompanyMain()
        { }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsCallback)
            {
                Baind();//绑定
            }
        }
       /// <summary>
       /// 绑定
       /// </summary>
        private void Baind()
        {
            IBLL_ProcurementBasic ipb = Factory.BLL_ProcurementBasic();
            string procureCatalogId = Request.QueryString["PID"];
            HZ.DrugTrade.Model.View.ProcureCatalog procureCatalog = ipb.GetProcureCatalogByID(procureCatalogId);
            if (procureCatalog != null)
            {
                txtGoodsName.Text = procureCatalog.GoodsName;
                txtCompany_SC.Text = procureCatalog.CompanyName_SC;
                txtCompany_TB.Text = procureCatalog.CompanyName_TB;
                txtProcurePrice.Text = procureCatalog.ProcurePrice.ToString();
                txtProject.Text = procureCatalog.ProjectName;
                //if (procureCatalog.SortSource == 0)
                //{
                //    txtSortSource.Text = "正常添加";
                //}
                //else if (procureCatalog.SortSource == 1)
                //{
                //    //txtSortSource.Text = "临时采购";
                //    txtSortSource.Text = "备案采购";
                //}
                companyId.Value = procureCatalog.CompanyIDs_PS;
                //companyName.Value = procureCatalog.CompanyNames_PS;
                hfdCompanyName.Value = procureCatalog.CompanyNames_PS;

                //将配送企业放入listbox中
                string companyName = procureCatalog.CompanyNames_PS;
                string companyID = procureCatalog.CompanyIDs_PS;
                txtCompany.Text = companyName;
            }
            else
            {
                PageError("采购产品不存在！", this.ReturnUrl);
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click1(object sender, EventArgs e)
        {

        }
    }
}
